﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace WindowsApplication2._902_图形图像.常用.Invalidate
{
    public partial class Form1 : Form
    {
        bool b = true;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            b = !b;

            if (b)
            {
                Font font = new Font("黑体", 28);
                SolidBrush blackpen = new SolidBrush(Color.Blue);

                e.Graphics.DrawString("VC#", font, blackpen, 65, 25);
                //e.Graphics.DrawString("VC#", font, bluepen, 61, 21);
            }
            else
            {
                Font font = new Font("黑体", 28);
                SolidBrush bluepen = new SolidBrush(Color.Black);
                e.Graphics.DrawString("VC#", font, bluepen, 65, 25);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Invalidate();
        }
    }
}